﻿#pragma once

class AnalyseTreeNodeCondition
{
public:
	AnalyseTreeNodeCondition(AnalyseTreeNodeCondition*& pFather) : m_pFatherNode(pFather) {}

	virtual void SetData(bool b) {}
	virtual void SetData(int n) {}
	virtual void SetData(std::wstring wstr) {}

	virtual bool DoExecute(const AnyData& input, std::wstring& wstrDescription) const = 0;
	virtual bool InsertNode(std::unique_ptr<AnalyseTreeNodeCondition> pNode) { return false; }

public:
	AnalyseTreeNodeCondition* GetFatherNode() const { return m_pFatherNode; }
protected:
	AnalyseTreeNodeCondition* m_pFatherNode;
};

class AnalyseTreeNodeConditionTrue : public AnalyseTreeNodeCondition
{
public:
	AnalyseTreeNodeConditionTrue(AnalyseTreeNodeCondition*& pFather) : AnalyseTreeNodeCondition(pFather) {}
	virtual bool DoExecute(const AnyData& input, std::wstring& wstrDescription) const;
	virtual bool InsertNode(std::unique_ptr<AnalyseTreeNodeCondition> pNode);
protected:
	std::unique_ptr<AnalyseTreeNodeCondition> m_pChildNode;
};

class AnalyseTreeNodeConditionNOT : public AnalyseTreeNodeCondition
{
public:
	AnalyseTreeNodeConditionNOT(AnalyseTreeNodeCondition*& pFather) : AnalyseTreeNodeCondition(pFather) {}
	virtual bool DoExecute(const AnyData& input, std::wstring& wstrDescription) const;
	virtual bool InsertNode(std::unique_ptr<AnalyseTreeNodeCondition> pNode);
protected:
	std::unique_ptr<AnalyseTreeNodeCondition> m_pChildNode;
};

class AnalyseTreeNodeConditionOR : public AnalyseTreeNodeCondition
{
public:
	AnalyseTreeNodeConditionOR(AnalyseTreeNodeCondition*& pFather) : AnalyseTreeNodeCondition(pFather) {}
	virtual bool DoExecute(const AnyData& input, std::wstring& wstrDescription) const;
	virtual bool InsertNode(std::unique_ptr<AnalyseTreeNodeCondition> pNode);
protected:
	std::list<std::unique_ptr<AnalyseTreeNodeCondition> > m_listChildNode;
};

class AnalyseTreeNodeConditionAND : public AnalyseTreeNodeCondition
{
public:
	AnalyseTreeNodeConditionAND(AnalyseTreeNodeCondition*& pFather) : AnalyseTreeNodeCondition(pFather) {}
	virtual bool DoExecute(const AnyData& input, std::wstring& wstrDescription) const;
	virtual bool InsertNode(std::unique_ptr<AnalyseTreeNodeCondition> pNode);
protected:
	std::list<std::unique_ptr<AnalyseTreeNodeCondition> > m_listChildNode;
};
